//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_waterfix.sqf"
#include "xr_macros.sqf"

private ["_helpero", "_weaps", "_mags", "_radius", "_endpos", "_markerpos", "_angle", "_x1", "_y1", "_p", "_center_x", "_center_y"];
__TRACE("black out");
173 cutText [(localize "STR_DOM_MISSIONSTRING_920"), "PLAIN"];
_helpero = d_HeliHEmpty createVehicleLocal (getPosASL player);
_radius = 20;
_endpos = getPosASL _helpero;
_markerpos = markerPos QGVARXR(center);
while {surfaceIsWater _endpos} do {
	_endpos = getPosASL _helpero;
	_center_x = _endpos select 0;
	_center_y = _endpos select 1;
	_angle = [_endpos, _markerpos] call FUNCXR(DirTo);
	_angle = _angle + 180;
	_x1 = _center_x - (_radius * sin _angle);
	_y1 = _center_y - (_radius * cos _angle);
	_endpos = [_x1, _y1, 0];
	_helpero setPos _endpos;
	sleep 0.01;
};
_p = player;
_p setPos _endpos;
//__TRACE("black in");
//172 cutText ["","BLACK IN", 1];
deleteVehicle _helpero;